<?php

class HandleData
{	
	/**
	 * Takes the response data & performs some action on it or with it
	 * Demonstrates 'Virtual Proxy' design pattern as one argument is an Interface instead of a class
	 * Benefit is obviously abstraction & encapsulation of details of how the decoding, prep etc. of the actual data is done for the different response types we may get(XML, JSON, AMF etc.)
	 * A bit more future proof code than the average bear does!
	 * @param $response
	 */
	public function doSomeAction(ResponseDataInterface $response)
	{
		if(!$response->isValid())	//make sure we got valid data response
			throw new ExceptionHandler('Invalid response, could not decode');
		$decoded_data = $response->decode();	//get the decoded data
		/*
		 * From here on we can proceed to do something with the $data as desired
		 */
		print_r($decoded_data);
	}
}